package com.xindong.zhitgx.factory;

import static com.xindong.zhitgx.MainActivity.mainContext;

import android.content.Context;

import com.meihu.beauty.utils.MhDataManager;
import com.tencent.trtc.TRTCCloud;
import com.tencent.trtc.TRTCCloudDef;
import com.tencent.trtc.TRTCCloudListener;

public class XinDongBeautyTRTC {

    public void setLocalVideoProcessListener(Context context) {
        TRTCCloud trtcCloud = TRTCCloud.sharedInstance(context.getApplicationContext());
        trtcCloud.setLocalVideoProcessListener(TRTCCloudDef.TRTC_VIDEO_PIXEL_FORMAT_Texture_2D, TRTCCloudDef.TRTC_VIDEO_BUFFER_TYPE_TEXTURE, new TRTCCloudListener.TRTCVideoFrameListener() {
            @Override
            public void onGLContextCreated() {
            }

            @Override
            public void onGLContextDestory() {
            }

            @Override
            public int onProcessVideoFrame(TRTCCloudDef.TRTCVideoFrame srcFrame, TRTCCloudDef.TRTCVideoFrame dstFrame) {
                dstFrame.texture.textureId = MhDataManager.getInstance().render(srcFrame.texture.textureId, srcFrame.width, srcFrame.height);
                return dstFrame.texture.textureId;
            }
        });
    }

}
